package com.hyt.it.ogt.pj.data.asynchronous;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.hyt.it.ogt.pj.data.service.pj.ICommonAutomaticAllocationService;

@Component
public class PjIncrementDataDistribution implements Runnable {

	private final Logger log = LoggerFactory.getLogger(PjIncrementDataDistribution.class);

	private String pjProjectId;
	private ICommonAutomaticAllocationService iCommonAutomaticAllocationService;

	
	public String getPjProjectId() {
		return pjProjectId;
	}

	public void setPjProjectId(String pjProjectId) {
		this.pjProjectId = pjProjectId;
	}

	public ICommonAutomaticAllocationService getiCommonAutomaticAllocationService() {
		return iCommonAutomaticAllocationService;
	}

	public void setiCommonAutomaticAllocationService(ICommonAutomaticAllocationService iCommonAutomaticAllocationService) {
		this.iCommonAutomaticAllocationService = iCommonAutomaticAllocationService;
	}

	@Override
	public void run() {
		try {
			log.info("## increment distribution start pjProjectId:{}", pjProjectId);
			if (StringUtils.isNotEmpty(pjProjectId)) {
				iCommonAutomaticAllocationService.commonAutomaticAllocation(pjProjectId);
			}
			log.info("## increment distribution end pjProjectId:{}", pjProjectId);
		} catch (Exception e) {
			log.error("increment distribution", e);
		}
	}
}
